package com.sky.mapper;


import com.sky.dto.GoodsSalesDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface ReportMapper {



    //根据订单状态和日期统计订单总金额<!--营业额复用-->
    double sumOrderAmountByStatusAndDate(Integer status, LocalDate date);

    //根据日期统计新增用户数<!--新增用户复用-->
    int countUserByDate(LocalDate date);

    //根据订单状态和日期统计订单量<!--有效订单复用-->
    int countOrderByStatusAndDate(Integer status, LocalDate date);

    //销量排名Top10
    List<GoodsSalesDTO> top10(LocalDate begin, LocalDate end);

    //查看套餐的起售停售状态
    @Select("select count(*) from setmeal where status = #{status}")
    Integer countSetmealByStatus(Integer status);

    //查看菜品起售停售状态
    @Select("select count(*) from dish where status = #{status}")
    Integer countDishByStatus(Integer status);

    //查看菜品和套餐的起售停售状态
    @Select("select count(*) from ${table} where status = #{status}")//注意${}
    Integer countDishAndSetmealByStatus(String table, Integer status);
}
